import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:getwidget/components/avatar/gf_avatar.dart';
import 'package:getwidget/components/list_tile/gf_list_tile.dart';
import 'package:getwidget/components/typography/gf_typography.dart';

import '../../constants.dart';

class Wallet extends StatefulWidget {
  const Wallet({Key? key}) : super(key: key);

  @override
  State<Wallet> createState() => _WalletState();
}

class _WalletState extends State<Wallet> {
  Widget moneyCard = Card(
    shape: RoundedRectangleBorder(
        borderRadius: BorderRadiusDirectional.circular(10)),
    elevation: 3,
    color: Color.fromRGBO(4, 197, 161, 1.0),
    child: SizedBox(
      width: 350,
      height: 150,
      child: Padding(
        padding: EdgeInsets.fromLTRB(25, 20, 20, 10),
        child: Column(
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text("可提现现金/元",
                    style: TextStyle(
                      color: Colors.white70,
                      fontSize: 16,
                      fontWeight: FontWeight.w600,
                    )),
                Icon(
                  Icons.help_outline,
                  color: Colors.white70,
                )
              ],
            ),
            SizedBox(
              height: 15,
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  "25,992",
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 40,
                    fontWeight: FontWeight.w900,
                  ),
                ),
                ElevatedButton(
                    onPressed: () {
                      Fluttertoast.showToast(
                        msg: "支付宝协议没通过，结算功能失效",
                        toastLength: Toast.LENGTH_SHORT,
                        gravity: ToastGravity.BOTTOM,
                      );
                    },
                    style: ButtonStyle(
                      shape: MaterialStateProperty.all(RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(30))),
                      backgroundColor: MaterialStateProperty.all(Colors.white),
                    ),
                    child: Text(
                      "  提现  ",
                      style: TextStyle(
                        color: Color.fromRGBO(48, 116, 95, 1.0),
                        fontSize: 18,
                        fontWeight: FontWeight.w700,
                      ),
                    ))
              ],
            ),
          ],
        ),
      ),
    ),
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(30),
        child: Column(
          children: [
            Center(
              child: moneyCard,
            ),
            // _buildRow(),
            const Padding(
              padding: EdgeInsets.fromLTRB(20, 20, 0, 0),
              child: GFTypography(
                text: '账单明细',
              ),
            ),
            const Divider(),
            const GFListTile(
                padding: EdgeInsets.zero,
                titleText: '买了个奶茶',
                icon: Text(
                  "-100",
                  style: TextStyle(color: Colors.red, fontSize: 15),
                )),
            const Divider(),
          ],
        ),
      ),
    );
  }
}
